<?php
namespace App\Domain\Examples;

use App\Model\Examples\City as ModelCURD;

class City {

    public function insert($newData) {
        $model = new ModelCURD();
        return $model->insert($newData);
    }

    public function update($id, $newData) {
        $model = new ModelCURD();
        return $model->update($id, $newData);
    }

    public function get($id) {
        $model = new ModelCURD();
        return $model->get($id);
    }
    public function getHotCitys(){
        $model=new ModelCURD();
        return $model->getHotCitys();
    }
    public function delete($id) {
        $model = new ModelCURD();
        return $model->delete($id);
    }
    public function getAllCitysByWord($word){
        $model = new ModelCURD();
        return $model->getAllCitysByWord($word);
    }
    public function getCitysByPingName($word){
        $model = new ModelCURD();
        return $model->getCitysByPingName($word);
    }
    public function getList($page, $perpage) {
        $rs = array('items' => array(), 'total' => 0);

        $model = new ModelCURD();
        $items = $model->getListItems($page, $perpage);
        $total = $model->getListTotal();

        $rs['items'] = $items;
        $rs['total'] = $total;

        return $rs;
    }
}
